n=int(input())
mi=3000000
ma=-3000000
if 999<int(n)<1000:
    
  for left in range(4):
    for right in range(left, 4):
        num= int(n[left:right+1])
        prunt(num)
        k=0
        for i in range(2,num//2+1):
         if(num%i==0): 
          k=k+1
        if k==0 and num !=0 and num !=1:
            if num>ma:
                ma=num
  if ma==-3000000:
    print('0')
  else:
       print('ma')
else:
    print('не четырёхзначное')
